package com.itheima.tlias.mapper;

import com.itheima.tlias.dto.ReportGenderCountDTO;
import com.itheima.tlias.dto.SelectEmpDTO;
import com.itheima.tlias.dto.SelectEmpDetailDTO;
import com.itheima.tlias.entity.Emp;
import com.itheima.tlias.po.InsertEmpParam;
import com.itheima.tlias.po.SelectEmpPageParam;
import com.itheima.tlias.po.UpdateEmpParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 都是Dao层注解
 *
 * @Mapper -> mybatis提供
 * @Repository -> 由SpringBoot提供
 */
@Mapper
public interface EmpMapper {

    List<SelectEmpDTO> selectEmpByPage(@Param("p") SelectEmpPageParam param);

    int batchDelete(@Param("ids") List<Integer> ids);

    int insertEmp(@Param("p") InsertEmpParam param);

    SelectEmpDetailDTO selectEmpById(@Param("id") Integer id);

    int updateEmp(@Param("p") UpdateEmpParam param);

    List<ReportGenderCountDTO> empGenderData();

    @Select("select job as count from emp")
    List<Integer> empJobData();

    List<SelectEmpDTO> selectAllMaster();

    @Select("select id,username,password,name from emp where username = #{username} ")
    Emp selectEmpByUsername(@Param("username") String username);
}
